package apiday01;

/**
 * static Sting valueOf（数据类型 a）:
 * 将其他数据类型转换为String
 */
public class ValueOfDemo {
    public static void main(String[] args) {
       int a = 123;
       String s1 = String.valueOf(a);
       double s2 =123.456789;
       System.out.println(s1);
       System.out.println(s2);


       /*int a = 123;
       String s1 = String.valueOf(a);
       System.out.println("s1:"+s1);
       double dou = 123.456789;
       String s2 = String.valueOf(dou);
       System.out.println(s2);

        */

       /* int a = 123;
        String s1 = String.valueOf(a);
        System.out.println("s1:"+s1);
        double dou = 123.45678;
        String s2 = String.valueOf(dou);
        System.out.println(s2);

        String s3 = a + "";//任何内容与字符串连接结果都是字符串，效率低
        String s4 = dou + "";
        System.out.println(s3);
        System.out.println(s4);
        */
    }
}
